﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace HardwareAs.Account
{
    public partial class Register : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
         
            
        }

        protected void CreateUserButton_Click(object sender, EventArgs e)
        {
            //If all info is valid then  Successfully infomation panel show out
            if (IsValid)
            {   
                SqlRequest db = new SqlRequest();
            
                int i=db.AddUser(FirstName.Text, LastName.Text, Email.Text, Password.Text, Address.Text, int.Parse(Age.Text));
                Panel1.Visible = false;
                Panel2.Visible = true;
      
            
            }
           
        }

        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            //Check the email if it already exists in database
            SqlRequest sb = new SqlRequest();
            args.IsValid=sb.CheckUserExist(Email.Text);
        }

   

    }
}
